Open to remote roles
Copied to clipboard ✓
Command Reference Heroku CLI Git · Docker · Container Click any command to copy

Heroku CLI
Toolbelt
Reference

A complete annotated guide to the Heroku Toolbelt — installation across all platforms, application management with Git, and container deployment with Docker. Click any command to copy it to clipboard.

4
Install methods
2
Deploy strategies
Git
Primary deploy method
🐳
Docker support

Install the Heroku CLI on your platform

🍎 macOS
🐧 Ubuntu / Debian
⚙️ Arch Linux
📦 npm (ARM / BSD)
🌐 cURL (Unix)
Homebrew (recommended for macOS)
macOS
brew tap heroku/brew && brew install heroku
Snap (Ubuntu 16+)
Ubuntu
sudo snap install --classic heroku
apt-get script
Debian / Ubuntu
curl https://cli-assets.heroku.com/install-ubuntu.sh | sh
yay (AUR — community maintained)
Arch Linux
yay -S heroku-cli
Note
The Arch AUR package is community-maintained, not official Heroku. Verify the PKGBUILD before installing.
npm (required for ARM and BSD)
npm
npm install -g heroku
cURL script (Unix-only, needs sudo)
Unix
curl https://cli-assets.heroku.com/install.sh | sh
Windows incompatible
The cURL install script is Unix-only and requires sudo. Use the npm method on Windows.
First steps after installation
setup
heroku --version
Verify the installation — should return the installed CLI version
verify
heroku login
Login to Heroku — opens a browser for authentication
auth
heroku login -i
Login entirely in the terminal without opening a browser
auth
Login troubleshooting
If you face login issues, rename the netrc file and try again:
mv ~/.netrc ~/.netrc.backup && heroku login

Step-by-step: from local project to live Heroku app

01
Navigate to your project
cd ~/myapp
Enter your application directory before running any Heroku commands.
setup
02
Initialise Git (if not already)
git init
Your project must be a Git repository before Heroku can deploy it.
git
03
Stage and commit your code
git add . && git commit -m "My first commit"
Use git add -f example.json to force-add files listed in .gitignore.
git
04
Create the Heroku app
heroku create appname
Creates the app on Heroku and automatically adds a heroku remote to your Git repo.
heroku
05
Verify the remote was added
git remote -v
Should show a heroku remote pointing to https://git.heroku.com/appname.git.
verify
06
Deploy to production
git push heroku master
Pushes your main branch to Heroku — triggers a build and deploy. Your app is live.
deploy
🔀 Git Deploy — All Commands
git deploy
heroku create appname
Create a new Heroku application named appname
create
git push heroku master
Deploy the master branch to Heroku
deploy
git push heroku master --force
Force-push to Heroku — required when the remote contains work you don't have locally
force
git push heroku testbranch:master
Deploy from a non-master local branch to Heroku's master
branch
heroku git:remote -a thawing-inlet-61413
Add a Heroku remote to an existing app (by app name)
remote
git remote rename heroku heroku-staging
Rename a Heroku remote — useful for managing multiple environments (staging, production)
remote
heroku create --ssh-git
Use SSH git transport instead of HTTPS for all git operations
ssh
git config --global url.ssh://git@heroku.com/.insteadOf https://git.heroku.com/
Always use SSH instead of HTTPS for Heroku git operations globally
ssh
git config --global --remove-section url.ssh://git@heroku.com/
Remove the SSH rewrite setting and revert to HTTPS
ssh

Build and release a container image to Heroku

01
Set your app's stack to Container
heroku stack:set container
Tells Heroku to use Docker instead of a buildpack for this application.
stack
02
Login to Container Registry
heroku container:login
Authenticate Docker with the Heroku Container Registry.
auth
03
Create the Heroku app
heroku create appname
Create the application if it doesn't exist yet. You can clone sample code first: git clone https://github.com/heroku/alpinehelloworld.git
create
04
Build and push the image
heroku container:push web
Builds the Docker image and pushes it to the Heroku Container Registry.
push
05
Release the image to your app
heroku container:release web
Deploys the pushed image — your app restarts with the new container.
release
06
Open the live application
heroku open
Opens your deployed application in the browser.
open
🐳 Docker Deploy — All Commands
container
heroku stack:set container
Set the app stack to Container (Docker mode)
stack
heroku container:login
Authenticate with the Heroku Container Registry
auth
heroku container:push web
Build the Docker image from current directory and push to the registry
push
heroku container:push --recursive
Push all Dockerfiles found recursively from the root directory
push
heroku container:push web worker --recursive
Build and push multiple process types (web and worker) recursively
push
heroku container:release web
Release the pushed image to your Heroku application
release
heroku open
Open the deployed application in the default browser
open

Removing the Heroku CLI

🗑 Uninstall — macOS
macOS
brew uninstall heroku && rm -rf ~/.local/share/heroku ~/Library/Caches/heroku
Uninstall via Homebrew and remove cache directories
remove
rm -rf /usr/local/heroku /usr/local/lib/heroku /usr/local/bin/heroku ~/.local/share/heroku ~/Library/Caches/heroku
Manual removal — for standalone macOS installs
remove
🗑 Uninstall — Linux
Linux
rm /usr/local/bin/heroku && rm -rf /usr/local/lib/heroku /usr/local/heroku && rm -rf ~/.local/share/heroku ~/.cache/heroku
Remove standalone Linux install completely
standalone
sudo apt-get remove heroku heroku-toolbelt && sudo rm /etc/apt/sources.list.d/heroku.list
Remove Debian / Ubuntu apt-get install, including the Heroku apt source
apt
Heroku CLI Toolbelt · Complete Reference
Install · Git Deploy · Docker Deploy · Uninstall
Heroku CLI Git deploy Docker container
Menu